/*
 * ReimsCopieUserLocal.java
 *
 * Created on 15 novembre 2007, 17:14
 */
package com.reimscopie.beans.interfaces ;

import com.reimscopie.* ;


/**
 * This is the local interface for the user/customer bean.
 */
public interface ReimsCopieUserLocal {
  
  
    
////////////////////////////////////////////////////////////////////////////////
//                                LOGIN                                       //
////////////////////////////////////////////////////////////////////////////////
  
  /**
   * Open the session. The user has to give a login and a password.
   *
   * <p>The session is not opened is the login and password are not correct.
   * In this case, this method returns <code>false</code>.
   *
   * @param login The user login.
   * @param password The user password.
   *
   * @return <code>true</code> if the session is successfuly opened,
   * <code>false</code> otherwise.
   */
  public boolean login(String login,String password) ;
  
  
  /**
   * Log out from the session.
   */
  public void logout() ;
  
  
  /**
   * Return is the user session has a logged account.
   *
   * @return <code>true</code> if the session is logged, <code>false</code>
   * otherwise.
   */
  public boolean isLogged() ;
  
  /**
   * Return the user account.
   *
   * @return The user account, or <code>null</code> is the user is not logger
   * in.
   */
  public Account getUserAccount() ;
  
   /**
   * Update a user account. The user has to give a account.
   *
   *@param login The news user account.
   *
   */
  public void updateUserAccount(Account account) ;
  
  
////////////////////////////////////////////////////////////////////////////////
//                                PRODUCT                                     //
////////////////////////////////////////////////////////////////////////////////
  
  /**
   * Return the product with the specified id. The product can be of any kind.
   *
   * @param id The product id.
   *
   * @return The specified product, or <code>null</code> if the id was not
   * found.
   */
  public Product getProduct(long id) ;
  
  
  /**
   * Return the simple product with the specified id.
   *
   * @param id The product id.
   *
   * @return The specified simple product, or <code>null</code> if the id was
   * not found.
   */
  public SimpleProduct getSimpleProduct(long id) ;
  
  
  /**
   * Get the list of all available SimpleProduct.
   *
   * @return All available simple products.
   */
  public SimpleProduct[] getSimpleProducts() ;
  
  
  /**
   * Get the list of all available SimpleProduct with the valid status.
   *
   * @return All available and valid simple products.
   */
  public SimpleProduct[] getValidSimpleProducts() ;
  
  
  /**
   * Return the special product with the specified id.
   *
   * @param id The product id.
   *
   * @return The specified special product, or <code>null</code> if the id was
   * not found.
   */
  public SpecialProduct getSpecialProduct(long id) ;
  
  
  /**
   * Get the list of all available SpecialProduct.
   *
   * @return All available special products.
   */
  public SpecialProduct[] getSpecialProducts() ;
  
  
  /**
   * Get the list of all available SpecialProduct with the valid status.
   *
   * @return All available and valid special products.
   */
  public SpecialProduct[] getValidSpecialProducts() ;
  
  
  /**
   * Search for available products in the database.
   *
   * @param expr The expression to search.
   *
   * @return The identifiers of the found products.
   */
  public long[] search(String expr) ;

  
  
////////////////////////////////////////////////////////////////////////////////
//                              CART                                          //
////////////////////////////////////////////////////////////////////////////////
  
  /**
   * Add a new purchase in the cart.
   *
   * @param purchase The purchase to add in the user's cart.
   */
  public void addPurchase(Purchase purchase) ;
    
  
  /**
   * Return all pruchase form the cart.
   *
   * @return All purchases.
   */
  public Purchase[] getCart() ;
  
  
  /**
   * Return the total price of the current cart.
   *
   * @return The total price of the current user's cart.
   */
  public float getCartPrice() ;
    
  
////////////////////////////////////////////////////////////////////////////////
//                               BON-PLANS                                    //
////////////////////////////////////////////////////////////////////////////////
  
  /**
   * Return the specified bon plan.
   *
   * @param id The bon plan identifier.
   */
  public BonPlan getBonPlan(long id) ;
  
  
  /**
   * Return all bon plans.
   *
   * @return All bon plans.
   */
  public BonPlan[] getBonPlans() ;
  
  /**
   * Return the best bon-plans.
   *
   * @return The best bons-plans.
   */
  public BonPlan getBestBonPlan() ;
  
}
